/* JavaLog - package tracker 
 * 
 * Copyright (C) 2009 Allyson Lima, Diego Pedro, Victor Freire
 * 
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software 
 * Foundation, either version 3 of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with this 
 * program. If not, see <http://www.gnu.org/licenses/>.
 */

package br.edu.ufcg.ccc.javalog.XML;

/**
 * A persistence XML class
 * 
 * @author Allyson Lima, Diego Pedro, Victor Freire
 * @version 27/11/09
 */
public abstract class PersistenceXML<O extends Object> { 

	/**
	 * Local tab for the date
	 */
	protected final String FILE_SEPARADOR = System.getProperties().get(
			"file.separator").toString();

	/**
	 * Path to the user directory
	 */
	protected final String USER_PATH = System.getProperties().get("user.dir")
			.toString()
			+ FILE_SEPARADOR + "Data";

	/**
	 * Save the objects in xml file
	 * 
	 * @param object
	 *            Object to be saved
	 * @throws Exception
	 *             Throw exception for invalid entries
	 */
	abstract public void save(O object) throws Exception;

	/**
	 * Loads an xml file entry for an object
	 * 
	 * @param id
	 *            Identifier of the object to be sought
	 * @return The object found
	 * @throws Exception
	 *             Throw exception for invalid entries
	 */
	abstract public O load(Object id) throws Exception;	

}
